/*
 * @Author       : wfl
 * @LastEditors  : wfl
 * @description  :
 * @updateInfo   :
 * @Date         : 2023-03-21 09:27:25
 * @LastEditTime : 2023-07-27 14:04:15
 */
export default function log() {
  return {
    name: 'log-plugin',
    apply: 'build',
    buildStart({ cache, input, plugins }: { cache: boolean; input: string; plugins: any[]; }) {
      console.info('\x1B[32m[iking-admin] 开始构建\x1B[0m')
      console.info(`\x1B[32m[iking-admin] 是否缓存: ${cache}\x1B[0m`)
      console.info(`\x1B[32m[iking-admin] 入口文件: ${input}\x1B[0m`)
      console.info(`\x1B[32m[iking-admin] 构建插件数量: ${plugins?.length}\x1B[0m`)
    },
    closeBundle(data: any) {
      console.info(`\x1B[32m[iking-admin] ${data ? '构建失败' : '构建完成'}\x1B[0m`)
    }
  }
}
